<?
    $v=$this->venue;
    $m=$this->message;
    $cv=$this->childrenVenues;
?>

<div style="width: 650px; top:500px; clear: both;" class="body" id="main">
	<div id="content">
            <article class="round_edge_10px block" id="venue_display_box">
                <section>
                    <figure id="venue_fig" class="">
                        <img width="100px" src="http://www.funkytemple.co.za/Pictures/Red%20Decorated%20Venue.jpg"/>
                        <div style="margin:2px; float:right; position: relative; left:-20px;">
                            <a href="" style="" id="venue_name"><?=$v->getVenue_name();?></a><br/>
                            
                                <?//=$v->getParent_name(); ?>
                        </div>
                    </figure>
                    <p id="user_desc" style="float:none;">
                   <?=$v->getVenue_des(); ?>
                    </p>
                    <a style="float:right;" href="/venue/universities">back to Universities</a>
                </section>
                
            </article>
            <article class="round_edge_10px block" id="venue_flickr_box">
                <section>
                   
                </section>
            </article>
		<article class="round_edge_10px block" id="main_post_box">
                 <p>What you want to say?</p>
                <textarea class="round_edge_5px" id="publish_editor" rows="" cols="" name="" accesskey="1" tabindex="1"
                          style="width:400px; font-family: Tahoma,宋体; border-style: solid; border-width:
                          1px; word-wrap: break-word; font-size: 14px; line-height: 18px; overflow-x: hidden;"
                          range="0&amp;0"></textarea>
                <button id="main_post_btn" onclick="try{ venue_post_submit(); } catch (e) {alert(e);}">Post</button>
		</article>
<? if ($messages!=null && sizeof($messages)>0){
    for($i=0;$i<sizeof($messages);$i++){
        $m=$messages[$i];
//        var_dump($m);die;
        ?>
        <article class="round_edge_10px block">
                    <input type="hidden" class="id_field1" value="<?=$m->getUser_id();?>"/>
                    <span class="post_time"><?=$m->getPublic_time(); ?></span>&nbsp;
                    <a href="" class="m_poster"><?=$m->getUser_name();?></a> said:
                <p class="m_post"><?=$m->getMessage_content();?></p>
                <p class="m_op">
                    <a class="m_venue_element"
                                  href="/venue?vid=<?=$m->getVenue_id();?>">
                        <?=$m->getVenue_name();?>
                    </a>
                    <a class="m_op_element" href="">Reply</a>
                </p>
          </article>
        <?
    }
}
else{
     ?> <article class="round_edge_10px block">
                  There is no messages.
      </article>
<?}
?>

	</div>
	<div id="sidebar">
        <aside id="featured1" name="bulletin" class="round_edge_10px block featured">
		<h4>Bulletin</h4>
                <?if (true){
                    echo "This is the day!";
                }?>
  	</aside>
        <aside id="featured3" name="friends" class="round_edge_10px block featured">
	<!--showing the recommendations-->
		<h4>Inside Places</h4>
                <?
                    for($i=0;$i<sizeof($cv);$i++){
                        
                        ?>
                        <div class="friend_element">
                            <a href="/message/getmessages?venue_id=<?=$cv[$i]->getVenue_id();?>">
                           <?= $cv[$i]->getVenue_name();?>
                        </a>
                        </div>
                        <?
                    }
                ?>
  	</aside>
	<!--end of featured recommendation-->
	</div>
        </div>

<?

if(isset($this->errorMessage)){

		echo $this->errorMessage;

}?>


<div>
	<?php foreach ($this->data as $message){?>
		<a href="#"><span><?=$message->getMessage_content()?>&nbsp;&nbsp;</span></a>
	<?php }?>
</div>



<script>
 var selected=new Array();
 selected['venue_id']='<?=$v->getVenue_id();?>';
 selected['venue_name']='<?=$v->getVenue_name();?>';
 function venue_post_submit(){
    alert("mp submit start.");
    var content=$("#publish_editor").val();
    if (!content){
        alert("Please enter key in something before you post!");
        return false;
    }
    //var uid= //$("#id_field").
    $.post("/message/postmessage",
    {'message_content':content,'venue_name':selected['_venue_name'],'venue_id':selected['_venue_id'],'message_id':'0'},
        function(json_data){
            alert(json_data.toString());
            },
        'json');
//                    alert('mp submit ends.');
 }
</script>